package com.yanqu.road.server.manager.activity.springunionbanquet;

import com.yanqu.road.entity.activity.springunionbanquet.SpringUnionBanquetJoinData;
import com.yanqu.road.entity.activity.springunionbanquet.SpringUnionBanquetOpenData;

import java.util.ArrayList;
import java.util.List;

public class UnionBanquetOpenInfo {

    /**
     * 开宴数据
     */
    private SpringUnionBanquetOpenData openData;

    /**
     * 参宴记录
     */
    private List<SpringUnionBanquetJoinData> joinDataList = new ArrayList<>();

    public UnionBanquetOpenInfo(SpringUnionBanquetOpenData openData) {
        this.openData = openData;
    }

    public SpringUnionBanquetOpenData getOpenData() {
        return openData;
    }

    public void setOpenData(SpringUnionBanquetOpenData openData) {
        this.openData = openData;
    }

    public List<SpringUnionBanquetJoinData> getJoinDataList() {
        return joinDataList;
    }

    public void setJoinDataList(List<SpringUnionBanquetJoinData> joinDataList) {
        this.joinDataList = joinDataList;
    }

    public SpringUnionBanquetJoinData findJoinByUserId(long userId){
        for (int i = 0; i < this.joinDataList.size(); i++) {
            SpringUnionBanquetJoinData joinData = joinDataList.get(i);
            if(joinData.getUserId() == userId){
                return joinData;
            }
        }
        return null;
    }
}
